package fileReader.demo.reader;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.geom.Point2D;


/**
 * This class is a storage class for depth contour data of a map.
 * This map layer also defines drawing functionality.
 */
public class ControlPointMapLayer extends MapLayer{

	/**
	 * Draws controlpoints to the display.
	 * @param g graphics
	 */
	public void drawLayer(Graphics g,double zoom, int xtrans, int ytrans) {
		  
		  for (int i = 0 ; i < data.size() ; i++) 
		  {
			  	double a,b; // xy-pixels on screen
				
				double minX=MapLayer.getGlobalMin_x();
			    double maxX=MapLayer.getGlobalMax_x();
			    double minY=MapLayer.getGlobalMin_y();
			    double maxY=MapLayer.getGlobalMax_y();
					
			    //scalex and scaley has to be the same for all the layers to get right proportions
				//scalex and scaley makes the map fit the screen
				double scalex = 1600.0/(maxX-minX);	//adapt this to your screen
				double scaley = 900.0/(minY-maxY);	//adapt this to your screen
				
				a = ((((Point2D)data.get(i)).getX() - minX)*(scalex))*zoom+xtrans;
				b = ((((Point2D)data.get(i)).getY() - minY)*(scaley)+900)*zoom+ytrans;
		    	
				
		    	g.setColor(Color.MAGENTA);
		    	g.drawOval((int)a,(int)b,(int)(6*zoom),(int)(6*zoom));
		    	g.fillOval((int)a,(int)b,(int)(6*zoom),(int)(6*zoom));	
		  }
	}
}
